home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / DB_CLIPP / 0669.ZIP / DB3BUGS.TXT < prev    next >
Text File  |  1985-11-30  |  11KB  |  194 lines

  1.                 dBASE III Bugs by LANA MOUNTFORD
  2.  
  3.      The first really troublesome bug deals with the INSERT command.
  4. If you INSERT a record into the middle of a file, the last (physical)
  5. record in the file is deleted.  However, if you then issue any command
  6. which shows # of records in the file (e.g., DISPLAY STRUCTURE), the
  7. "new correct" number is displayed.  Example: File contains 36 records;
  8. INSERT a new record after #21; DISPLAY STRUCTURE will show # of records
  9. as 37, but if you LIST ALL or DISPLAY ALL, only 36 records will appear.
  10. The "original" 36th record will be missing.  Ashton-Tate has a fix for
  11. this one in the works, but in the meantime, you can get around it two
  12. ways.  If the order of the records isn't important, just use APPEND,
  13. which places the new record at the end of the file.  If order is
  14. critical, you'll need to create a new work file, APPEND from the "real"
  15. file all the records you want to appear before the new record; then
  16. APPEND the new record, and finally APPEND the rest of the records from
  17. the "real" file.  Now, you have two files.  At this point, go into DOS,
  18. delete the original "real" file, and rename the new file.  Of course,
  19. all of this is moot if the file is indexed -- APPEND will automatically
  20. place the record in its proper (logical) position.
  21.  
  22.      This one involves one of the new field types -- the MEMO  field.
  23. When you JOIN a file which contains a MEMO field with a file which does
  24. not contain a MEMO field, any attempt to USE the resulting file will
  25. cause you to bomb, with the message "File does not exist -- Memo file
  26. cannot be opened."  Even if FIELDS was specified, and the Memo field
  27. was specifically excluded, you will still get this error.  Example:
  28.  
  29. SELECT 1
  30. USE <file which doesn't contain MEMO field> ALIAS S1
  31. SELECT 2
  32. USE <file which contains MEMO field> ALIAS S2
  33. JOIN WITH S1 TO TEMPFILE FOR <etc., etc.>
  34. USE TEMPFILE
  35.  
  36. At this point the nasty message appears.  Actually, the file does
  37. exist, but you can't get to it.  It seems dBASE uses the structure of
  38. the active file (in this case, the file in area 2 [ALIAS S2] is the
  39. active file) to establish the structure of the target file, taking into
  40. account any FIELDS specified.  However, it also seems to carry over the
  41. fact that the active file contains a pointer to a MEMO file (.DBT), but
  42. does nothing about copying/not copying over the actual memo records.
  43. The work-around is pretty obvious -- always join the file WITHOUT the
  44. MEMO field with the file with the MEMO field.  In the above example,
  45. after definition of the two areas (after the second USE statement),
  46. you can insert:
  47.  
  48. SELECT 1
  49.  
  50. then, change the JOIN statement:
  51.  
  52. JOIN WITH S2 TO TEMPFILE FOR <etc., etc.>
  53.  
  54. This causes the file WITHOUT the MEMO field to become the active file,
  55. and the resulting file will work with no problems.
  56.  
  57.      We had some interesting times with the new PICTURE feature.  I was
  58. trying to edit input using a PICTURE of '@R 9/A99' which, according to
  59. the manual should result in a 5-character field, the first character of
  60. which must be numeric, the second character a slash (/), the third
  61. character must be alpha, and the last two characters must be numbers.
  62. When this was used with GET, however, only characters were allowed in
  63. ANY position -- it would not allow numbers to be entered at all!
  64.  
  65.      Concerning speed -- did you follow the advice in the dBASE III
  66. manual to set BUFFERS = 24 in your CONFIG.SYS file?  If so, try
  67. lowering it 5 or so.  According to Ashton-Tate, someone came up with
  68. the 24, but their tests show optimum performance at around 15 or so.
  69. In any case, speed improved by about 40%!
  70.  
  71.      EXACT ON doesn't work.  DON'T USE IT!  We found this one when
  72. duplicate records started cropping up in our production master file.
  73. For those unfamiliar with how EXACT works, it is something like this:
  74. in dBASE, some fields compare as equal when they aren't REALLY equal.
  75. Example: 'ABC' is equal to 'ABCDEFGH'.  If you want this situation,
  76. you SET EXACT ON to force the match to be an exact character-for-
  77. character comparison.  In the above case, 'ABC' not equal 'ABCDEFGH'.
  78. In our application, it is critical that there be no duplicates on the
  79. master file, so of course we used SET EXACT ON.  In the data entry
  80. routine, the user enters the identification code.  We then do a FIND
  81. on the master file, and if we have a hit, the user is notified of the
  82. duplicate situation.  If a FIND condition occurs, the user is allowed
  83. to truck on -- entering the rest of the initial data.  In our case,
  84. we were getting random FINDs when in fact the duplicates existed.
  85. Took us over four hours track down all of the double entries and
  86. correct the file.
  87.  
  88.      This really falls into the category of idiosyncrasy, and REALLY
  89. poor documentation.  It concerns the new DATE field category, and the
  90. features in the PICTURE clause.  Basically, the following is
  91. undocumented but true.  If a character variable contains the value
  92. '00/00/00' and is then converted to a date-formatted field via CTOD
  93. function, the resulting field value will be '11/30/99'.  If the
  94. character variable is initialized to '99/99/99', then converted via
  95. CTOD, the result will be '06/23/07'.  However, if the variable is
  96. initialized to '/ / ', then converted, the result is ' / / '!  Also,
  97. one of the new PICTURE features allows you to edit for valid date by
  98. using PICTURE '@D'.  According to the dBASEIII manual, this restricts
  99. entry via a GET to valid MO/DA/YR.  What the book doesn't tell you is
  100. that the field MUST be defined as a date field.  When dealing with
  101. memory variables, you can really only declare them three ways:
  102.  
  103. Character (as in STORE 'abcde' to M_VAR)
  104. Numeric   (as in STORE 19.75 to M_VAR)
  105. Logical   (as in STORE .T. to M_VAR)
  106.  
  107. unless you initialize them via STORE from a database or with a function
  108. command acting on an already-defined variable.  Then:
  109.  
  110. STORE '  /  /  ' TO M_VAR
  111. STORE CTOD(M_VAR) TO M_VAR
  112. @ x,y GET M_VAR PICTURE '@D'
  113. READ
  114.  
  115. This creates the variable as character, converts it to date format,
  116. then restricts the entry of M_VAR to valid dates only.  The error
  117. message appears at the top of the screen in line 0, and goes away upon
  118. re-entry or spaces, which dBASE seems to treat as a valid date.  I
  119. know of no way to declare one DIRECTLY as a date field.  As far as I
  120. know, you HAVE to declare it as character first, then do the function
  121. to get it into what dBASE recognizes as date format.  You should not
  122. try to store a memory variable defined as a character in a database
  123. field defined as DATE.  Example: REPLACE EFF_DATE WITH M_DATE, where
  124. M_DATE is character and EFF_DATE is DATE.  dBASE is REAL picky about
  125. things like that, resulting in the error message:
  126.  
  127. DATA TYPE MISMATCH
  128. TERMINATE COMMAND FILE (Y/N)?
  129.  
  130. I want to preface this with some basic facts:
  131.  
  132.      1) ALL of these have been reported to A-T in one form or another
  133. and confirmed by them.
  134.      2) I am NOT out to 'get' A-T.
  135.      3) There are apparently two (and possibly even three) different
  136. versions of version 1.0 of dBASE III.  I am working with the EARLIEST
  137. version of version 1.0 which is where all of these bugs were
  138. encountered.  I have the second version of version 1.0, and have just
  139. started testing our system with it.  I have encountered at least one
  140. new bug (again verified by A-T) in this version.  Some of what I am
  141. reporting here MAY NOT appear in these later version(s).
  142.      4) The work-arounds provided are in most cases my own, since this
  143. does not appear to be A-T's strong suit.  That does not mean that the
  144. work-arounds are necessarily the best ones, just ones that I have come
  145. up with that work for me.  If others have found better ones, PLEASE
  146. say so!  That is one of the reasons I started this whole thing in the
  147. first place.
  148.  
  149.      While the the User Manual for dBASE III is a definite improvement
  150. over the one supplied for dBASE II, it still has some shortcomings.
  151. The index is screwed up.  Some items don't have page numbers, quite a
  152. few numbers are wrong (topic doesn't appear on the referenced page),
  153. and some page numbers are non-existent.  For example, look up "field
  154. - definition, 3-1,7-3".  Not only does field names definition not
  155. appear on page 3-1 (it's actually on pg 3-2), but there is no page 7
  156. in the entire manual.  There are also more typos that one I would
  157. expect to find in a package of this price.  
  158.  
  159.      I was told of another idiosyncrasy dealing with many of the
  160. filter or dual-positioning SET commands (e.g., SET COLOR TO, SET
  161. RELATION TO, SET DELETED, etc.).  When using one of these, it may
  162. appear at first that the command isn't working.  If the command is
  163. issued after a USE (and most of them have to be issued with at least
  164. one file in use), it will NOT apply to the current record.  Example:
  165. You are currently USEing a file and are pointed at a record marked for
  166. deletion.  You now SET DELETED to "hide" all records marked for
  167. deletion.  If you now DISPLAY the current record, you will see the
  168. current record even though it is marked for deletion.  In order for
  169. the command to take effect, you must cause some movement in the file.
  170. I usually follow the command with GO TOP, or if the command is issued
  171. immediately after the USE, A-T says to issue GO BOTTOM followed by GO
  172. TOP so that the first record is considered.
  173.  
  174.      The next problem was particularly sticky because A-T was never
  175. able to locate it.  The work-around is even stranger.  I noticed a
  176. problem with cursor positioning on entry of decimal numbers.  The
  177. problem occurred whenever decimal input was attempted (in a READ of a
  178. numeric field) after access of any .DBF file USEd with INDEX.  In these
  179. situations, as soon as the decimal point was entered, the cursor was
  180. immediately positioned at the beginning of the entry, rather than at
  181. the first decimal position.  It didn't matter whether PICTURE was used
  182. or not; the cursor would ALWAYS pop back to the first position of the
  183. field, rather than the first position after the decimal point.  We ran
  184. a number of tests and found that if the READ was preceded by ANY access
  185. (SEEK, FIND, LOCATE) of a file USEd with an INDEX, then the problem
  186. appeared.  Further, if multiple files were in USE, if the active file
  187. had been last USEd with an index and accessed, the problem occurred.
  188. The problem did not appear with files USEd without indexes.  The work-
  189. around?  Start lowering the # of BUFFERS in your CONFIG.SYS file.  (If
  190. you haven't already, it should be 15 or so for maximum efficiency).
  191. We had already lowered ours 15, so we tried lowering it to 10, and
  192. the problem disappeared.  One other user, according to A-T, caused the
  193. problem to disappear by going from BUFFERS = 24 to BUFFERS = 17.  
  194.